We develop method that allows to derive reductions and solutions to hyperbolic systems of partial differential equations. The method is based on using functions that are constant in the direction of characteristics of the system. These functions generalize well-known Riemann invariants. As applications we consider the gas dynamics system and ideal magnetohydrodynamics equations. In special cases we find solutions of these equations depending on some arbitrary functions.